const TokenKey = 'Token'
const TokenTypeKey = 'Token-Type'
const FreshTokenKey = 'Fresh-Token'
const Userinfo = 'userinfo'
const BaseUrl = 'baseUrl'
const ConnectedBluetooth = 'connectedBluetooth'
const ConnectedSerialport = 'connectedSerialport'
const AutoSubmitParams = 'autoSubmitParams'
export const GeneralStationMachineLinkage = 'generalStationMachineLinkage'
export const EsopWorkOrderNumber = 'esopWorkOrderNumber'
export const EsopPreLineAddStation = 'esopPreLineAddStation'
const CurrentConnectedBluetoothList = 'currentConnectedBluetoothList'

export function getToken() {
  const token = process.env.VUE_APP_APPLICATION_TOKEN || "";
  return localStorage.getItem(TokenKey) || token;
}
export function setToken(token) {
  return localStorage.setItem(TokenKey, token)
}

export function setTokenType(tokenType) {
  return localStorage.setItem(TokenTypeKey, tokenType)
}

export function removeTokenTypeKey() {
  return localStorage.removeItem(TokenTypeKey)
}

export function getTokenType() {
  return localStorage.getItem(TokenTypeKey) || 'Bearer'
}

export function removeToken() {
  return localStorage.removeItem(TokenKey)
}

export function setFreshToken(freshToken) {
  return localStorage.setItem(FreshTokenKey, freshToken)
}

export function getFreshToken() {
  return localStorage.getItem(FreshTokenKey)
}

export function removeFreshToken() {
  return localStorage.removeItem(FreshTokenKey)
}

export function getUserinfo() {
  return localStorage.getItem(Userinfo)
}

export function setUserinfo(userinfo) {
  return localStorage.setItem(Userinfo, userinfo)
}

export function removeUserinfo() {
  return localStorage.removeItem(Userinfo)
}

export function getBaseUrl() {
  return localStorage.getItem(BaseUrl)
}

export function setBaseUrl(baseUrl) {
  return localStorage.setItem(BaseUrl, baseUrl)
}

export function removeBaseUrl() {
  return localStorage.removeItem(BaseUrl)
}

export function getConnectedBluetooth() {
  return localStorage.getItem(ConnectedBluetooth)
}

export function setConnectedBluetooth(connectedBluetooth) {
  return localStorage.setItem(ConnectedBluetooth, connectedBluetooth)
}

export function removeConnectedBluetooth() {
  return localStorage.removeItem(ConnectedBluetooth)
}

export function getConnectedSerialport() {
  return sessionStorage.getItem(ConnectedSerialport)
}

export function setConnectedSerialport(connectedSerialport) {
  return sessionStorage.setItem(ConnectedSerialport, connectedSerialport)
}

export function removeConnectedSerialport() {
  return sessionStorage.removeItem(ConnectedSerialport)
}

export function getAutoSubmitParams() {
  return localStorage.getItem(AutoSubmitParams)
}

export function setAutoSubmitParams(autoSubmitParams) {
  return localStorage.setItem(AutoSubmitParams, autoSubmitParams)
}

export function removeAutoSubmitParams() {
  return localStorage.removeItem(AutoSubmitParams)
}

export function getGeneralStationMachineLinkage() {
  return localStorage.getItem(GeneralStationMachineLinkage)
}

export function setGeneralStationMachineLinkage(generalStationMachineLinkage) {
  return localStorage.setItem(
    GeneralStationMachineLinkage,
    generalStationMachineLinkage
  )
}

export function removeGeneralStationMachineLinkage() {
  return localStorage.removeItem(GeneralStationMachineLinkage)
}

export function getEsopWorkOrderNumber() {
  return sessionStorage.getItem(EsopWorkOrderNumber) || ''
}

export function setEsopWorkOrderNumber(esopWorkOrderNumber) {
  return sessionStorage.setItem(EsopWorkOrderNumber, esopWorkOrderNumber)
}

export function removeEsopWorkOrderNumber() {
  return sessionStorage.removeItem(EsopWorkOrderNumber)
}

export function getEsopPreLineAddStation() {
  return localStorage.getItem(EsopPreLineAddStation)
}

export function setEsopPreLineAddStation(esopPreLineAddStation) {
  return localStorage.setItem(EsopPreLineAddStation, esopPreLineAddStation)
}

export function removeEsopPreLineAddStation() {
  return localStorage.removeItem(EsopPreLineAddStation)
}




/**添加 */

export function setCurrentConnectedBluetoothList(
  currentConnectedBluetoothList
) {
  return sessionStorage.setItem(
    CurrentConnectedBluetoothList,
    currentConnectedBluetoothList
  )
}

export function getCurrentConnectedBluetoothList() {
  return sessionStorage.getItem(CurrentConnectedBluetoothList);
}
